#ifndef DRAGBUTTON_H
#define DRAGBUTTON_H

#include <QObject>
#include <QMouseEvent>
#include"touchbutton.h"

class DragButton : public TouchButton
{
    Q_OBJECT
public:
    explicit DragButton(QWidget *parent = nullptr);

protected:
    void mousePressEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;

private:
    bool m_bPressed;
    bool m_bDraged;       // 是否正在拖动
    QPoint m_dragStartPos;   // 鼠标按下时的位置
    QPoint m_buttonStartPos; // 按钮初始位置
};

#endif // DRAGBUTTON_H
